import  Axios  from  'axios';
import  {  serverHost,port   }  from '../config/index';
//创建一个实例
let  r = Axios.create({
    baseURL:`${serverHost}:${port}`
});
let request = function(url='',options={}) {
   //将promise 对象返回
   return function() {
         if(url==='') {
            return Promise.reject('必须传递url');
         }
          return  r({
            url,
            ...options,
            method:'get'
          });
   }
}
export  default   request;
